<?php
header("Content-type:text/html;charset=utf-8");
date_default_timezone_set('PRC');
class EasyPHP{
	static public function run(){
		define('EASYPHP_PATH', dirname(__FILE__).'/');
		//加载框架所需核心文件
		self::loadFile();
		self::createIntiDir();
		APP::run();
	}
	static function loadFile(){
		$files=require EASYPHP_PATH.'files.php';
		foreach($files as $f){
			is_file($f) and require $f;
 		}
	}
	static public function createIntiDir(){
		if(is_dir(APP_PATH))return;
		$dir=array(
			APP_PATH,//应用路径
			APP_PATH.'Index/',//模块路径
			APP_PATH.'Index/Controller',//控制器路径
			APP_PATH.'Index/View/Index/',//模板文件路径
			APP_PATH.'Index/View/Index/Compile/',//编译文件路径
			APP_PATH.'Index/View/Public/',//公共模板路径
			APP_PATH.'Index/View/Public/Compile/',//公共模板编译路径
			APP_PATH.'Index/Model/',//模块路径
			APP_PATH.'Index/Config/',//模块路径
		);
		foreach($dir as $d){
			is_dir($d) or mkdir($d,0755,true);
		}
		copy(EASYPHP_PATH.'Tpl/Controller.php',APP_PATH.'Index/Controller/IndexController.class.php');
		copy(EASYPHP_PATH.'Tpl/index.html',APP_PATH.'Index/View/Index/index.html');
		copy(EASYPHP_PATH.'Tpl/success.html',APP_PATH.'Index/View/Public/success.html');
		copy(EASYPHP_PATH.'Tpl/success.html',APP_PATH.'Index/View/Public/error.html');
		copy(EASYPHP_PATH.'Config.php',APP_PATH.'Index/Config/Config.php');
	}
}
EasyPHP::run();
?>